In Dart, there’s a convention to distinguish between public API and the implementation details. It states:
- Files inside
lib/src
are considered internal implementation detail, and shouldn’t be referenced
- Other files inside the
lib
directory are publicly accessible and are safe to be imported
Introducing the dependency on the internal implementation of other packages is not recommended as it is the subject to change and may introduce
maintainability issues and break your code unexpectedly.
Exceptions
It is still safe to reference libraries from lib/src
within the same package.